﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinqToTwitter;



namespace DDNY.WebPortals.Common
{
    public class TwitterHelper
    {
        public static List<Search> GetTweets(string searchString)
        {
            SingleUserAuthorizer singleUserAuthorizer = new SingleUserAuthorizer()
            {
                Credentials = new InMemoryCredentials()
                {
                    ConsumerKey = "ygwNi31knXGelK47zfKsA",
                    ConsumerSecret = "DA9oYMqZHXIpBH567TLj1Fm8LXnFCrROVRx7EdVqk",
                    OAuthToken = "87395666-Mqq3Kn6UtbFsSfxpl98PDI8TLt7WjT9pKLLaP7koe",

                    AccessToken = "vIQIjOInIEAAjABkEGsAzBwIyrz56ASNo50ObL1cceU"
                }
            };



            using (var twitterContext = new TwitterContext(singleUserAuthorizer))
            {
                var queryResults =
                    from search in twitterContext.Search
                    where search.Type == SearchType.Search &&
                          search.Query == searchString
                    select search;
                return queryResults.ToList();
            }
        }
    }
}
